﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace lcmyjobs.Web.Admin
{
    public partial class LoginList : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                if ( Session["adminlogin"] !=null)
                {
                    Bind();
                }
                else
                {
                    Maticsoft.Common.MessageBox.ShowAndRedirect(this, "请先登陆总站！","AdminLogin2.aspx");
                }
                
            }
        }

        private void Bind()
        {
            lcmyjobs.BLL.admin_type at = new BLL.admin_type();

            DataSet ds = at.GetList("atid!=1");
           
            this.RadioButtonList1.DataSource = ds.Tables[0].DefaultView;

            this.RadioButtonList1.DataTextField = "atname";
            this.RadioButtonList1.DataValueField = "atid";

            this.RadioButtonList1.DataBind();
        
        }
        
        protected void btn_login_Click(object sender, EventArgs e)
        {
            string value = "";
            if (this.RadioButtonList1.SelectedItem != null)
            {
                value = this.RadioButtonList1.SelectedItem.Value;
            }
            

            if (!string.IsNullOrEmpty(value))
            {
                Session["AdminLogin2"] = value;
                Response.Redirect("AdminLogin2.aspx");
            }
            else
            {
                Maticsoft.Common.MessageBox.Show(this,"请选择所要登陆的二级网站！");
            }
        }
    }
}